package cn.itcast.client.fallback;

import cn.itcast.client.UserClient;
import cn.itcast.pojo.User;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * @author Xiao
 * @version 1.0
 * @description 失败降级逻辑
 * @date 2021/11/14
 */
@Slf4j
public class UserClientFallbackFactory implements FallbackFactory<UserClient> {
    @Override
    public UserClient create(Throwable throwable) {
        return id -> {
            log.error("查询用户信息异常:", throwable);
            return new User();
        };
    }
}
